import matplotlib.pyplot as plt
from io import BytesIO
from PIL import Image
import cairosvg

# Read SVG data and convert it to PNG
svg_data = open(r'/svg/32h.svg').read()
png_data = BytesIO()

# Convert SVG to PNG
cairosvg.svg2png(bytestring=svg_data.encode('utf-8'), write_to=png_data)

# Move to the start of the BytesIO object before reading it
png_data.seek(0)

# Use PIL to open the PNG image
img = Image.open(png_data)

# Display the image with matplotlib
plt.imshow(img)
plt.axis('off')  # Turn off the axes
plt.show()
